<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <input value="0" type="button">
  <button onclick="zan()">++</button>
  <button onclick="an()">--</button>

  <script type="text/javascript">
    var arr = document.querySelector('input')
    let i = 0
    function zan() {
      arr.value = ++i
    }
    function an() {
      if (arr.value > 0) {
        arr.value = --i
      }
      else {
        alert('0000000')
      }
    }
  </script>
</body>

</html>